﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CMS.BLL;


public partial class Controls_Tour_ctrInitTour : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    public void initTourData(DataTable dtbTour)
    {
        
    }
    protected void rptTour_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string strCommand = e.CommandName;
        int nID = ConvertData.ConvertToInt(e.CommandArgument);
        
        switch (strCommand)
        {
            case "image":
                string sDetail = Config.ROOT + Pages.FrontEnds.TOUR_DETAIL + "?" + Config.TOUR_ID + "=" + nID;
                Response.Redirect(sDetail);
                break;
        }
    }
    protected void rptTour_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
        {
            int nCurrentLanguage = Support.GetCurrentLanguage();
            int nDefaultLanguage = Support.GetDefaultLanguage();

            HyperLink lnkTourName = (HyperLink)e.Item.FindControl("lnkTourName");
            HyperLink lnkReadMore = (HyperLink)e.Item.FindControl("lnkReadMore");
            lnkTourName.NavigateUrl = Config.ROOT + Pages.FrontEnds.TOUR_DETAIL + "?" + Config.TOUR_ID + "=" + ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "TourID"));
            lnkReadMore.NavigateUrl = Config.ROOT + Pages.FrontEnds.TOUR_DETAIL + "?" + Config.TOUR_ID + "=" + ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "TourID"));

            ImageButton imgbtnTour = (ImageButton)e.Item.FindControl("imgTour");
            imgbtnTour.ImageUrl = Config.ROOT + Config.IMAGE_TOUR_UPLOAD + ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "Image"));
            imgbtnTour.CommandArgument = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "TourID"));

            Literal ltrTour = (Literal)e.Item.FindControl("ltrTour");
            ltrTour.Text = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "InitContent"));
            lnkTourName.Text = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "Title"));
            lnkReadMore.Text = MultipleLanguage.LINK_READMORE[nCurrentLanguage - 1];
        }
    }
}